/*
	enumdecl.h 
	Created by kiminouso, 2022/11/29, Hohai University
	仿java枚举自动映射宏定义文件(声明用)
*/
#pragma once
#ifndef enumdecl_h__
#define enumdecl_h__
#include <map>
#include <string>

#undef ENUM_BEGIN
#undef ENUM_ENTRY
#undef ENUM_END

#define ENUM_BEGIN(classname) class classname{\
public:\
	enum _MyEnum


#define ENUM_ENTRY(txt,id,val) txt=id

#define ENUM_END(classname) ;\
private: \
	static std::map<u_int64_t, string_ptr > str; \
	static std::map<string_ptr , u_int64_t> str_int;\
	string_ptr  currstr;\
	_MyEnum _enum;\
public:\
	classname();\
	_MyEnum& operator=(_MyEnum& rgt);\
	_MyEnum& operator=(classname& rgt);\
	bool operator==(classname& rgt) const;\
	bool operator==(_MyEnum& rgt) const;\
	string_ptr  toString() const; \
	int value() const;\
	static string_ptr  toString(_MyEnum& val);\
	static u_int64_t of(string_ptr  type);\
};
#endif // enumdecl_h__
